package com.xgd.phylw.controller;

import com.xgd.phylw.bean.Hall;
import com.xgd.phylw.service.HallService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class HallController {
    @Autowired
    private HallService hallService;
    @RequestMapping("UpdateHall")
    public String UpdateHall(Hall hall,Model model){
        hallService.UpdateHall(hall);
        List<Hall> halls = hallService.SelectAllHall();
        model.addAttribute("halls",halls);
        return "studio";
    }
    @RequestMapping("addHall")
    public String DeleteHall(Hall hall,Model model){
        System.out.println(hall);
        int i = hallService.addHall(hall);
        List<Hall> halls = hallService.SelectAllHall();
        model.addAttribute("halls",halls);
        return "studio";
    }
}
